﻿using HuaweiCloud.Dotnet.Samples.ESports.Main.Entities;
using Microsoft.EntityFrameworkCore;

namespace HuaweiCloud.Dotnet.Samples.ESports.Main.Repository
{
    public class DefaultDbContext : DbContext
    {
        public DefaultDbContext(DbContextOptions<DefaultDbContext> options) : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<Device>().HasData(
                new Device(Guid.Parse("3a06c51a-6e21-a649-9e97-53bc47f43e14"), "GT", "Watch"),
                new Device(Guid.Parse("3a06c51a-6e21-b5f2-4677-4ec78262ca93"), "GT2", "Watch"),
                new Device(Guid.Parse("3a06c51a-6e21-7592-bb55-89c4edf9bb57"), "GT3 Pro", "Watch"),
                new Device(Guid.Parse("3a06c51a-6e21-a561-638f-89fa821f172b"), "GT3 Lite", "Watch")
            );
            modelBuilder.Entity<User>().HasData(
                new User(Guid.Parse("3a06c51a-6e21-057c-1eed-2aff1eb5cdf0"), "Gigee"),
                new User(Guid.Parse("3a06c51a-6e21-3f07-4163-11e24cb8d827"), "Bane"),
                new User(Guid.Parse("3a06c51a-6e21-d700-d4ef-0e34feb853ae"), "Zoom"),
                new User(Guid.Parse("3a06c51a-6e21-e703-c8dc-33f6f826e6bb"), "Lara")
            );
            modelBuilder.Entity<BindInfo>().HasData(
                new BindInfo(Guid.Parse("3a06c51a-6e21-be46-dd1c-f1f5b7b37188"), Guid.Parse("3a06c51a-6e21-057c-1eed-2aff1eb5cdf0"), Guid.Parse("3a06c51a-6e21-a649-9e97-53bc47f43e14")),
                new BindInfo(Guid.Parse("3a06c51a-6e21-70bc-1bda-f0e338cbd304"), Guid.Parse("3a06c51a-6e21-3f07-4163-11e24cb8d827"), Guid.Parse("3a06c51a-6e21-b5f2-4677-4ec78262ca93")),
                new BindInfo(Guid.Parse("3a06c51a-6e21-dad5-4f6c-69778cf84d54"), Guid.Parse("3a06c51a-6e21-d700-d4ef-0e34feb853ae"), Guid.Parse("3a06c51a-6e21-7592-bb55-89c4edf9bb57")),
                new BindInfo(Guid.Parse("3a06c51a-6e21-5eb1-82f3-a5e8722446d7"), Guid.Parse("3a06c51a-6e21-e703-c8dc-33f6f826e6bb"), Guid.Parse("3a06c51a-6e21-a561-638f-89fa821f172b"))
            );
        }

        public DbSet<Device> Devices { get; set; }
        public DbSet<BindInfo> BindInfos { get; set; }
        public DbSet<CommunityEvents> CommunityEventses { get; set; }
        public DbSet<CompletedEvents> CompletedEventses { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Points> Pointses { get; set; }
    }
}
